<!--
 * @Desc: 
 * @Author: xuelianYi
 * @Date: 2021-09-26 18:24:34
 * @LastEditors: xuelianYi
 * @LastEditTime: 2021-09-27 14:47:29
 * @FilePath: \canvas\03绘制图像\practice.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var isValid = function (s) {
            signList = ['()', '{}', '[]']
            for (var i = 0; i < s.length; i++) {

                for (var k = 0; k < 3; k++) {
                    if (signList[k][0] === s[i]) {
                        if (signList[k][1] === s[s.length - 1 - i]) {
                            break
                        } else {
                            // return false'
                            console.log('false');
                        }
                    }
                }

            }
            // return true
            console.log('true');
        };

        isValid('()')
    </script>
</body>

</html>